package com.gsy.springai.entity.vo;


import lombok.Data;
import org.springframework.ai.chat.messages.Message;

@Data
public class MessageVO {
    private String role;
    private String content;
    //创建构造方法  将 message 转换成messageVO
    public MessageVO(Message message) {
        //message.getMessageType()   根据类型填充对应的角色
        switch (message.getMessageType()){
            case USER :
                role = "user";
                break;
            case ASSISTANT:
                role = "assistant";
                break;
            default:
                role = "";
                break;

        }
        //填充消息
        this.content = message.getText();
    }

}
